NO TICKET: make pytest and behave interoperable#234
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. |
|
I don't understand why this is preferable. What issues were you having seeding the database. The current solution is idempotent |
|
When
|
|
By keeping it flexible and tearing down the data after each test we won't have to worry about |
|
I don't see the point of removing seed data. Removing data added by a test is acceptable, but removing seed data solely to re-add it does not make sense. The seed functions need to be idempotent (and for the most part, they are) without requiring the removal of data add the end of a test suite. |
jirhiker
left a comment
There was a problem hiding this comment.
I will approve this to keep this moving forward. I don't see that as a necessary solution now but it seems to address the issues you are having
Why
This PR addresses the following problem / context:
I'm running into errors seeding the testing data for
behavetests. This occurs after I runpytest(either on its own or forgit commit), which erases and repopulates the database for thepytesttests. It does not, however, teardown and build the database back up. Because of this, theids of all tables get incremented, so whenbehavetesting data are added that depend on a hardcodedid(sensor, deployment) an error occurs because thatidis out of date.How
Implementation summary - the following was changed / added / removed:
Notes
Any special considerations, workarounds, or follow-up work to note?
ids. Due to this, unique constraints are broken. To address this, I tear down all of the testing data inafter_all. This should be quicker and easier than runningerase_and_rebuild_dbat the start of everybehavetesting session